home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.3
/
SetVar.3
< prev
next >
Wrap
Text File
|
1995-07-25
|
11KB
|
199 lines
TTTTccccllll____SSSSeeeettttVVVVaaaarrrr((((3333)))) TTTTccccllll ((((7777....0000)))) TTTTccccllll____SSSSeeeettttVVVVaaaarrrr((((3333))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
Tcl_SetVar, Tcl_SetVar2, Tcl_GetVar, Tcl_GetVar2,
Tcl_UnsetVar, Tcl_UnsetVar2 - manipulate Tcl variables
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
char *
TTTTccccllll____SSSSeeeettttVVVVaaaarrrr(_i_n_t_e_r_p, _v_a_r_N_a_m_e, _n_e_w_V_a_l_u_e, _f_l_a_g_s)
char *
TTTTccccllll____SSSSeeeettttVVVVaaaarrrr2222(_i_n_t_e_r_p, _n_a_m_e_1, _n_a_m_e_2, _n_e_w_V_a_l_u_e, _f_l_a_g_s)
char *
TTTTccccllll____GGGGeeeettttVVVVaaaarrrr(_i_n_t_e_r_p, _v_a_r_N_a_m_e, _f_l_a_g_s)
char *
TTTTccccllll____GGGGeeeettttVVVVaaaarrrr2222(_i_n_t_e_r_p, _n_a_m_e_1, _n_a_m_e_2, _f_l_a_g_s)
int
TTTTccccllll____UUUUnnnnsssseeeettttVVVVaaaarrrr(_i_n_t_e_r_p, _v_a_r_N_a_m_e, _f_l_a_g_s)
int
TTTTccccllll____UUUUnnnnsssseeeettttVVVVaaaarrrr2222(_i_n_t_e_r_p, _n_a_m_e_1, _n_a_m_e_2, _f_l_a_g_s)
AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
Tcl_Interp *_i_n_t_e_r_p (in) Interpreter containing
variable.
char *_v_a_r_N_a_m_e (in) Name of variable. May
refer to a scalar
variable or an element of
an array variable.
char *_n_e_w_V_a_l_u_e (in) New value for variable.
int _f_l_a_g_s (in) OR-ed combination of bits
providing additional
information for
operation. See below for
valid values.
char *_n_a_m_e_1 (in) Name of scalar variable,
or name of array variable
if _n_a_m_e_2 is non-NULL.
char *_n_a_m_e_2 (in) If non-NULL, gives name
of element within array
and _n_a_m_e_1 must refer to
an array variable.
Page 1 (printed 7/10/95)
TTTTccccllll____SSSSeeeettttVVVVaaaarrrr((((3333)))) TTTTccccllll ((((7777....0000)))) TTTTccccllll____SSSSeeeettttVVVVaaaarrrr((((3333))))
_________________________________________________________________
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
These procedures may be used to create, modify, read, and
delete Tcl variables from C code. TTTTccccllll____SSSSeeeettttVVVVaaaarrrr and
TTTTccccllll____SSSSeeeettttVVVVaaaarrrr2222 will create a new variable or modify an existing
one. Both of these procedures set the given variable to the
value given by _n_e_w_V_a_l_u_e, and they return a pointer to a copy
of the variable's new value, which is stored in Tcl's
variable structure. Tcl keeps a private copy of the
variable's value, so the caller may change _n_e_w_V_a_l_u_e after
these procedures return without affecting the value of the
variable. If an error occurs in setting the variable (e.g.
an array variable is referenced without giving an index into
the array), then NULL is returned.
The name of the variable may be specified in either of two
ways. If TTTTccccllll____SSSSeeeettttVVVVaaaarrrr is called, the variable name is given
as a single string, _v_a_r_N_a_m_e. If _v_a_r_N_a_m_e contains an open
parenthesis and ends with a close parenthesis, then the
value between the parentheses is treated as an index (which
can have any string value) and the characters before the
first open parenthesis are treated as the name of an array
variable. If _v_a_r_N_a_m_e doesn't have parentheses as described
above, then the entire string is treated as the name of a
scalar variable. If TTTTccccllll____SSSSeeeettttVVVVaaaarrrr2222 is called, then the array
name and index have been separated by the caller into two
separate strings, _n_a_m_e_1 and _n_a_m_e_2 respectively; if _n_a_m_e_2 is
zero it means that a scalar variable is being referenced.
The _f_l_a_g_s argument may be used to specify any of several
options to the procedures. It consists of an OR-ed
combination of any of the following bits:
TCL_GLOBAL_ONLY
Under normal circumstances the procedures look up
variables at the current level of procedure call for
_i_n_t_e_r_p, or at global level if there is no call active.
However, if this bit is set in _f_l_a_g_s then the variable
is looked up at global level even if there is a
procedure call active.
TCL_LEAVE_ERR_MSG
If an error is returned and this bit is set in _f_l_a_g_s,
then an error message will be left in _i_n_t_e_r_p->_r_e_s_u_l_t.
If this flag bit isn't set then no error message is
left (_i_n_t_e_r_p->_r_e_s_u_l_t will not be modified).
TCL_APPEND_VALUE
If this bit is set then _n_e_w_V_a_l_u_e is appended to the
current value, instead of replacing it. If the
Page 2 (printed 7/10/95)
TTTTccccllll____SSSSeeeettttVVVVaaaarrrr((((3333)))) TTTTccccllll ((((7777....0000)))) TTTTccccllll____SSSSeeeettttVVVVaaaarrrr((((3333))))
variable is currently undefined, then this bit is
ignored.
TCL_LIST_ELEMENT
If this bit is set, then _n_e_w_V_a_l_u_e is converted to a
valid Tcl list element before setting (or appending to)
the variable. A separator space is appended before the
new list element unless the list element is going to be |
the first element in a list or sublist (i.e. the |
variable's current value is empty, or contains the |
single character ``{'', or ends in `` }'').
TTTTccccllll____GGGGeeeettttVVVVaaaarrrr and TTTTccccllll____GGGGeeeettttVVVVaaaarrrr2222 return the current value of a
variable. The arguments to these procedures are treated in
the same way as the arguments to TTTTccccllll____SSSSeeeettttVVVVaaaarrrr and TTTTccccllll____SSSSeeeettttVVVVaaaarrrr2222.
Under normal circumstances, the return value is a pointer to
the variable's value (which is stored in Tcl's variable
structure and will not change before the next call to
TTTTccccllll____SSSSeeeettttVVVVaaaarrrr or TTTTccccllll____SSSSeeeettttVVVVaaaarrrr2222). The only bits of _f_l_a_g_s that are
used are TCL_GLOBAL_ONLY and TCL_LEAVE_ERR_MSG, both of
which have the same meaning as for TTTTccccllll____SSSSeeeettttVVVVaaaarrrr. If an error
occurs in reading the variable (e.g. the variable doesn't
exist or an array element is specified for a scalar
variable), then NULL is returned.
TTTTccccllll____UUUUnnnnsssseeeettttVVVVaaaarrrr and TTTTccccllll____UUUUnnnnsssseeeettttVVVVaaaarrrr2222 may be used to remove a
variable, so that future calls to TTTTccccllll____GGGGeeeettttVVVVaaaarrrr or TTTTccccllll____GGGGeeeettttVVVVaaaarrrr2222
for the variable will return an error. The arguments to
these procedures are treated in the same way as the
arguments to TTTTccccllll____GGGGeeeettttVVVVaaaarrrr and TTTTccccllll____GGGGeeeettttVVVVaaaarrrr2222. If the variable is |
successfully removed then TCL_OK is returned. If the |
variable cannot be removed because it doesn't exist then |
TCL_ERROR is returned. If an array element is specified,
the given element is removed but the array remains. If an
array name is specified without an index, then the entire
array is removed.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
Tcl_TraceVar
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
array, interpreter, scalar, set, unset, variable
Page 3 (printed 7/10/95)